package bb.lanxing.lib.devices.bici.model;

import bb.lanxing.lib.devices.bici.BiciDate;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.text.SimpleDateFormat;

public class BiciPoint implements Serializable {
    private int alt;
    private short crank;
    private int cumulativecrank;
    private int cumulativewheel;
    private short flag;
    private final int index;
    private int lat;
    private int lon;
    private int speed;
    private long timestamp;
    private final String timestampString;
    private short wheel;

    public BiciPoint(byte[] bArr, int i) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        ByteBuffer wrap = ByteBuffer.wrap(bArr);
        this.lon = wrap.getInt();
        this.lat = wrap.getInt();
        this.alt = wrap.getInt();
        long biciDateToTimestamp = BiciDate.biciDateToTimestamp(wrap.getInt());
        this.timestamp = biciDateToTimestamp;
        this.timestampString = simpleDateFormat.format(biciDateToTimestamp);
        this.speed = wrap.getInt();
        this.cumulativewheel = wrap.getInt();
        this.cumulativecrank = wrap.getInt();
        this.crank = wrap.getShort();
        this.wheel = wrap.getShort();
        this.flag = wrap.getShort();
        this.index = i;
    }

    public String toString() {
        return "\n index = " + this.index + "\n lon = " + this.lon + "\n lat = " + this.lat + "\n alt = " + this.alt + "\n timestamp = " + this.timestamp + " , " + this.timestampString + "\n speed = " + this.speed + "\n cumulativecrank = " + this.cumulativecrank + "\n cumulativewheel = " + this.cumulativewheel + "\n crank = " + ((int) this.crank) + "\n wheel = " + ((int) this.wheel) + "\n flag = " + ((int) this.flag);
    }

    public int getIndex() {
        return this.index;
    }

    public short getFlag() {
        return this.flag;
    }

    public void setFlag(short s) {
        this.flag = s;
    }

    public int getLon() {
        return this.lon;
    }

    public void setLon(int i) {
        this.lon = i;
    }

    public int getLat() {
        return this.lat;
    }

    public void setLat(int i) {
        this.lat = i;
    }

    public int getAlt() {
        return this.alt;
    }

    public void setAlt(int i) {
        this.alt = i;
    }

    public int getSpeed() {
        return this.speed;
    }

    public void setSpeed(int i) {
        this.speed = i;
    }

    public long getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(long j) {
        this.timestamp = j;
    }

    public short getCrank() {
        return this.crank;
    }

    public void setCrank(short s) {
        this.crank = s;
    }

    public short getWheel() {
        return this.wheel;
    }

    public void setWheel(short s) {
        this.wheel = s;
    }

    public int getCumulativecrank() {
        return this.cumulativecrank;
    }

    public void setCumulativecrank(int i) {
        this.cumulativecrank = i;
    }

    public int getCumulativewheel() {
        return this.cumulativewheel;
    }

    public void setCumulativewheel(int i) {
        this.cumulativewheel = i;
    }
}
